﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DacSanMienTayOBJ;
public partial class UserControl_ManagerGroupProduct : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        InsertGroupProductForm();
    }

    private void InsertGroupProductForm()
    {
        try
        {
            string groupName = Request["txtGroupName"];
            string keyword = Request["txtKeyword"];

            GroupProduct group = new GroupProduct();
            group.GroupName = groupName;
            group.MetaKeyword = keyword;
            group.IsVisible = 1;
            group.Priority = 1;
            bool rs = GroupProductBusiness.InsertGroupProduct(group, ConnectionType.AdminConnection);
            if (rs)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Đã thêm nhóm sản phẩm')", true);
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Không thêm được nhóm sản phẩm. Vui lòng liên hệ admin')", true);
            }
        }
        catch
        {

        }
    }
}